﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Modelo;

namespace Interface
{
    /// <summary>
    /// Interaction logic for EditarPago.xaml
    /// </summary>
    public partial class EditarPago : Window
    {
        public void habilitar(int mes,string salario,string fecha)
        {
            mes--;
            switch (mes)
            { 
                case 0:
                    checkBox1.IsChecked = true;
                    label14.Content = salario;
                    label15.Content = fecha;
                    break;
                case 1:
                    checkBox2.IsChecked = true;
                    label16.Content = salario;
                    label17.Content = fecha;
                    break;
                case 2:
                    checkBox3.IsChecked = true;
                    label18.Content = salario;
                    label19.Content = fecha;
                    break;
                case 3:
                    checkBox4.IsChecked = true;
                    label20.Content = salario;
                    label21.Content = fecha;
                    break;
                case 4:
                    checkBox5.IsChecked = true;
                    label22.Content = salario;
                    label23.Content = fecha;
                    break;
                case 5:
                    checkBox6.IsChecked = true;
                    label24.Content = salario;
                    label25.Content = fecha;
                    break;
                case 6:
                    checkBox7.IsChecked = true;
                    label31.Content = salario;
                    label32.Content = fecha;
                    break;
                case 7:
                    checkBox8.IsChecked = true;
                    label33.Content = salario;
                    label34.Content = fecha;
                    break;
                case 8:
                    checkBox9.IsChecked = true;
                    label35.Content = salario;
                    label36.Content = fecha;
                    break;
                case 9:
                    checkBox10.IsChecked = true;
                    label37.Content = salario;
                    label38.Content = fecha;
                    break;
                case 10:
                    checkBox11.IsChecked = true;
                    label39.Content = salario;
                    label40.Content = fecha;
                    break;
                case 11:
                    checkBox12.IsChecked = true;
                    label41.Content = salario;
                    label42.Content = fecha;
                    break;
            }
        }
        public EditarPago(string nombreUsusario)
        {
            InitializeComponent();
            TotalSalarios t= Proceso.GestorSalarios.buscarUsuario(nombreUsusario);
            List<Modelo.Salario> salarios = Proceso.GestorSalarios.obtenerSueldos(nombreUsusario);
            foreach(Modelo.Salario salario in salarios)
                habilitar(salario.Mes,salario.salario.ToString(),salario.Fecha.ToString());
            label28.Content=t.Nombre+" "+t.Apellido;
            label30.Content = t.TotalCobrado;

        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
